namespace IQIGame.Onigao.GamePlay
{
    public interface IGameAreaAccessor
    {
        bool GetCheckPointActive(TViewEntity entity);
    }

    public class MainCityGameAreaAccessor : IGameAreaAccessor
    {
        public bool GetCheckPointActive(TViewEntity entity)
        {
            return entity is MainCityBaseEntity { dynEntity: DynMainCityEntity { isCheckPointActive: true } };
        }
    }

    public class LevelGameAreaAccessor : IGameAreaAccessor
    {
        public bool GetCheckPointActive(TViewEntity entity)
        {
            if (entity is not LevelPlayBaseEntity levelEntity) return false;
            var dynEntity = levelEntity.GetDynLevelEntity();
            return dynEntity?.isCheckPointActive ?? false;
        }
    }
}